# Declaration of variables
CC = g++
CC_FLAGS = -Wall -g -c --std=c++98 -I../common
LDFLAGS =  -lpthread 

# File names
EXEC = server
SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:.cpp=.o)

# Main target
$(EXEC): $(OBJECTS)
	cd ../common && $(MAKE)
	cp ../common/common.a .
	$(CC) $(OBJECTS) common.a $(LDFLAGS) -o $(EXEC)

# To obtain object files
%.o: %.cpp 
	$(CC) $(CC_FLAGS) $< -o $@

# To remove generated files
clean:
	rm -f $(EXEC) $(OBJECTS) common.a

all: $(EXEC)

.PHONY: all